package com.shms.bean;

/**
 * 文件名：DoubleArray.java
 * 编写者：习孟冬
 * 创建时间：2013-1-18
 * 简要描述：
 * 不定长Double类型动态数组
 */
public class DoubleArray {
	//数组长度
	private int theSize = 0;
	//数组
    private Double newDouble[] = {};
    
    public DoubleArray(){
        this.theSize=0;
    }
    
    public DoubleArray(Double temp[]){
        this.newDouble = temp;
        this.theSize = temp.length;
    }

    /**
     * 数组增加一个数值
     * @param temp Double 对象
     */
    public void add(Double temp) {
    	Double oldDouble[] = this.newDouble;
    	this.newDouble = new Double[this.theSize + 1];
    	for (int i = 0; i < oldDouble.length; i++) {
    		this.newDouble[i] = oldDouble[i];
    	}
    	if(this.theSize > 0){
    		this.newDouble[this.theSize] = temp;
    	}else{
    		this.newDouble[0] = temp;
    	}
    	this.theSize++;
    }
    
	public int getTheSize() {
		return theSize;
	}

	public void setTheSize(int theSize) {
		this.theSize = theSize;
	}

	public Double[] getNewDouble() {
		return newDouble;
	}

	public void setNewDouble(Double[] newDouble) {
		this.newDouble = newDouble;
	}
}
